quasi_newton_solver Derived Type

type, public, extends(line_search_solver) :: quasi_newton_solver

Defines a quasi-Newton solver based upon Broyden's method. The algorithm maintains an approximate Jacobian and updates the iterate from the nonlinear system $F(x)=0$ using with the rank-one Jacobian correction where .


Type-Bound Procedures

procedure, public :: get_fcn_tolerance => es_get_fcn_tol

  • private pure function es_get_fcn_tol(this) result(x)

    Gets the convergence on function value tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(in) :: this

    The equation_solver object.

    Return Value real(kind=real64)

    The tolerance value.

procedure, public :: get_gradient_tolerance => es_get_grad_tol

  • private pure function es_get_grad_tol(this) result(x)

    Gets the convergence on slope of the gradient vector tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(in) :: this

    The equation_solver object.

    Return Value real(kind=real64)

    The tolerance value.

procedure, public :: get_jacobian_interval => qns_get_jac_interval

  • private pure function qns_get_jac_interval(this) result(n)

    Gets the number of iterations that may pass before forcing a recalculation of the Jacobian matrix.

    Arguments

    Type IntentOptional Attributes Name
    class(quasi_newton_solver), intent(in) :: this

    The quasi_newton_solver object.

    Return Value integer(kind=int32)

    The number of iterations.

procedure, public :: get_line_search => lss_get_line_search

procedure, public :: get_max_fcn_evals => es_get_max_eval

  • private pure function es_get_max_eval(this) result(n)

    Gets the maximum number of function evaluations allowed during a single solve.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(in) :: this

    The equation_solver object.

    Return Value integer(kind=int32)

    The maximum number of function evaluations.

procedure, public :: get_print_status => es_get_print_status

  • private pure function es_get_print_status(this) result(x)

    Gets a logical value determining if iteration status should be printed.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(in) :: this

    The equation_solver object.

    Return Value logical

    True if the iteration status should be printed; else, false.

procedure, public :: get_use_line_search => lss_get_use_search

  • private pure function lss_get_use_search(this) result(x)

    Gets a value determining if a line-search should be employed.

    Arguments

    Type IntentOptional Attributes Name
    class(line_search_solver), intent(in) :: this

    The line_search_solver object.

    Return Value logical

    Returns true if a line search should be used; else, false.

procedure, public :: get_var_tolerance => es_get_var_tol

  • private pure function es_get_var_tol(this) result(x)

    Gets the convergence on change in variable tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(in) :: this

    The equation_solver object.

    Return Value real(kind=real64)

    The tolerance value.

procedure, public :: is_line_search_defined => lss_is_line_search_defined

  • private pure function lss_is_line_search_defined(this) result(x)

    Tests to see if a line search module is defined.

    Arguments

    Type IntentOptional Attributes Name
    class(line_search_solver), intent(in) :: this

    The line_search_solver object.

    Return Value logical

    Returns true if a module is defined; else, false.

procedure, public :: set_default_line_search => lss_set_default

  • private subroutine lss_set_default(this)

    Establishes a default line_search object for the line search module.

    Arguments

    Type IntentOptional Attributes Name
    class(line_search_solver), intent(inout) :: this

    The line_search_solver object.

procedure, public :: set_fcn_tolerance => es_set_fcn_tol

  • private subroutine es_set_fcn_tol(this, x)

    Sets the convergence on function value tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(inout) :: this

    The equation_solver object.

    real(kind=real64), intent(in) :: x

    The tolerance value.

procedure, public :: set_gradient_tolerance => es_set_grad_tol

  • private subroutine es_set_grad_tol(this, x)

    Sets the convergence on slope of the gradient vector tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(inout) :: this

    The equation_solver object.

    real(kind=real64), intent(in) :: x

    The tolerance value.

procedure, public :: set_jacobian_interval => qns_set_jac_interval

  • private subroutine qns_set_jac_interval(this, n)

    Sets the number of iterations that may pass before forcing a recalculation of the Jacobian matrix.

    Arguments

    Type IntentOptional Attributes Name
    class(quasi_newton_solver), intent(inout) :: this

    The quasi_newton_solver object.

    integer(kind=int32), intent(in) :: n

    The number of iterations.

procedure, public :: set_line_search => lss_set_line_search

procedure, public :: set_max_fcn_evals => es_set_max_eval

  • private subroutine es_set_max_eval(this, n)

    Sets the maximum number of function evaluations allowed during a single solve.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(inout) :: this

    The equation_solver object.

    integer(kind=int32), intent(in) :: n

    The maximum number of function evaluations.

procedure, public :: set_print_status => es_set_print_status

  • private subroutine es_set_print_status(this, x)

    Sets a logical value determining if iteration status should be printed.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(inout) :: this

    The equation_solver object.

    logical, intent(in) :: x

    True if the iteration status should be printed; else, false.

procedure, public :: set_use_line_search => lss_set_use_search

  • private subroutine lss_set_use_search(this, x)

    Sets a value determining if a line-search should be employed.

    Arguments

    Type IntentOptional Attributes Name
    class(line_search_solver), intent(inout) :: this

    The line_search_solver object.

    logical, intent(in) :: x

    Set to true if a line search should be used; else, false.

procedure, public :: set_var_tolerance => es_set_var_tol

  • private subroutine es_set_var_tol(this, x)

    Sets the convergence on change in variable tolerance.

    Arguments

    Type IntentOptional Attributes Name
    class(equation_solver), intent(inout) :: this

    The equation_solver object.

    real(kind=real64), intent(in) :: x

    The tolerance value.

procedure, public :: solve => qns_solve

  • private subroutine qns_solve(this, fcn, x, fvec, ib, args)

    Applies the quasi-Newton's method developed by Broyden in conjunction with a backtracking type line search to solve N equations of N unknowns.

    See Also:

    Arguments

    Type IntentOptional Attributes Name
    class(quasi_newton_solver), intent(inout) :: this

    The quasi_newton_solver object.

    class(vecfcn_helper), intent(in) :: fcn

    The vecfcn_helper object containing the equations to solve.

    real(kind=real64), intent(inout), dimension(:) :: x

    On input, an N-element array containing an initial estimate to the solution. On output, the updated solution estimate. N is the number of variables.

    real(kind=real64), intent(out), dimension(:) :: fvec

    An N-element array that, on output, will contain the values of each equation as evaluated at the variable values given in x. If the iteration process does not converge, each element is returned as NaN, and, if supplied, ib will indicate a failure to converge.

    type(iteration_behavior), optional :: ib

    An optional output, that if provided, allows the caller to obtain iteration performance statistics.

    class(*), intent(inout), optional :: args

    An optional argument to allow the user to communicate with fcn.